add_header_element ( "script", {
    	"type":"text/javascript",
        "src":"http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
    } 
) 

var Attendance = function ( type, user_id, event_id, event_type ) {
	this.type = type;
	this.user_id = user_id;
	this.event_id = event_id;
	this.event_type = event_type;
}

function callPublish(msg, attachment, action_link) {
  FB.ensureInit(function () {
    FB.Connect.streamPublish(msg, attachment, action_link, null, '', callback=attendance_create);
  });
}

function attendance_create(post_id, exception) {
	if (post_id) {
		new Ajax.Request('/attendance_update.php', {
			method: 'post',
			parameters: {action:'create', type:att.type, user_id:att.user_id, event_id:att.event_id, event_type:att.event_type},
			onSuccess: function() {reload()},
		});
	}
}

function attendance_delete(type, user_id, event_id, event_type) {
	new Ajax.Request('/attendance_update.php', {
		method: 'post',
		parameters: {action:'delete', type:type, user_id:user_id, event_id:event_id, event_type:event_type},
		onSuccess: function() {reload()},
	});
}

function reload() {
	javascript:location.reload();
}


// Hello, world!